# !/usr/bin/python3
# -*- coding: utf-8 -*-
# ------------------------------------------
# @Time    : Date - 2021/9/4   Time - 10:15
# @Author  : Spence Guo Tang
# @FileName: T1.py
# ------------------------------------------

import sys
from typing import List


def func(scores: List[List[int]]):
    row, col = len(scores), len(scores[0])

    max_sum = scores[0][0]
    for r in range(row):
        total = [0] * col
        for k in range(r, row):
            current_max = 0
            for c in range(col):
                total[c] += scores[k][c]
                if current_max > 0:
                    current_max += total[c]
                else:
                    current_max = total[c]
                max_sum = current_max if current_max > max_sum else max_sum
    return max_sum


if __name__ == '__main__':
    N = int(sys.stdin.readline().strip())
    score = list(map(int, sys.stdin.readline().strip().split(" ")))
    matrix = []
    for i in range(0, N*N, N):
        matrix.append(score[i:i+N])
    print(func(matrix))
